﻿using Entitas;
class PlayerKilledSystem : ICleanupSystem
{
    PlayerContext playerContext;
    public PlayerKilledSystem(Contexts contexts)
    {
        playerContext = contexts.player;
    }
    public void Cleanup()
    {
        foreach(var e in playerContext.GetEntities())
        {
            if (e.hitPoint.value <= 0)
            {
                e.playerHitPointListener.value[0].OnHitPoint(e, 0);
                e.baseView.value.DestoryView();
                e.Destroy();
            }
        }
    }
}
